<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>console.interactive.InteractiveCommand</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="console-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/console/">console</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="console-module.html">Package&nbsp;console</a> ::
        <a href="console.interactive-module.html">Module&nbsp;interactive</a> ::
        Class&nbsp;InteractiveCommand
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="console.interactive.InteractiveCommand-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class InteractiveCommand</h1><p class="nomargin-top"><span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand">source&nbsp;code</a></span></p>
<p>Base class for all commands to be added to the Interactive Shell. This
  is essentially an empty shell class that provides an interface to methods
  that must be implemented for all children. If not implemented, a 
  <code>NotImplementedError</code> is raised.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>str</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="console.interactive.InteractiveCommand-class.html#get_name" class="summary-sig-name">get_name</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Getter method for the name of the command- by implementing this 
      method, you will set the command name utilized by <a 
      href="console.interactive.InteractiveShell-class.html" 
      class="link">InteractiveShell</a>.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_name">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>dict</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="console.interactive.InteractiveCommand-class.html#get_options" class="summary-sig-name">get_options</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Getter method for the options that manipulate the execution of the 
      command.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_options">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="console.interactive.InteractiveCommand-class.html#handle_command" class="summary-sig-name">handle_command</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">opts</span>,
        <span class="summary-sig-arg">args</span>)</span><br />
      Called by <a href="console.interactive.InteractiveShell-class.html" 
      class="link">InteractiveShell</a> when it recieves the name of the 
      command, identified by <a 
      href="console.example.CustomShell._CustomCommand-class.html#get_name"
      class="link">get_name</a>.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.handle_command">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>str</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="console.interactive.InteractiveCommand-class.html#get_short_description" class="summary-sig-name">get_short_description</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Getter method for the short description of the command.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_short_description">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>docstr</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="console.interactive.InteractiveCommand-class.html#get_help_message" class="summary-sig-name">get_help_message</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Getter method for the usage and instruction of using a command.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_help_message">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="get_name"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_name</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_name">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Getter method for the name of the command- by implementing this 
  method, you will set the command name utilized by <a 
  href="console.interactive.InteractiveShell-class.html" 
  class="link">InteractiveShell</a>. This prevents use of a named attribute
  for the class.</p>
  <p>Usage: <code>return 'name'</code></p>
  <dl class="fields">
    <dt>Returns: <code>str</code></dt>
        <dd>The name of the command</dd>
  </dl>
</td></tr></table>
</div>
<a name="get_options"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_options</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_options">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Getter method for the options that manipulate the execution of the 
  command. By implementing this method you will set the options of the 
  command that are parsed by the interpreter.</p>
  <p>The options dictionary is constructed with the name of the option (the
  longopt format is the default) as the key. If the option is a flag or 
  required, then set the value to <code>None</code>, else, set it to the 
  default value. If the option takes an argument, ensure '=' is appended to
  the option name.</p>
  <p>Usage: <code>return {'opt1': None, 'opt2=': 'default', 'required=': 
  None}</code></p>
  <dl class="fields">
    <dt>Returns: <code>dict</code></dt>
        <dd>The options dictionary, constructed as described above.</dd>
  </dl>
</td></tr></table>
</div>
<a name="handle_command"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">handle_command</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">opts</span>,
        <span class="sig-arg">args</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.handle_command">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Called by <a href="console.interactive.InteractiveShell-class.html" 
  class="link">InteractiveShell</a> when it recieves the name of the 
  command, identified by <a 
  href="console.example.CustomShell._CustomCommand-class.html#get_name" 
  class="link">get_name</a>. This method is essentially the worker task of 
  the command and is the entrance point for specific program logic.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>opts</code></strong> (<code>dict</code>) - The result of <a 
          href="console.interactive-module.html#get_option_dict" 
          class="link">get_option_dict</a>, whose keys are taken from <a 
          href="console.example.CustomShell._CustomCommand-class.html#get_options"
          class="link">get_options</a></li>
        <li><strong class="pname"><code>args</code></strong> (<code>str</code>) - The raw string passed to the command, useful for debugging or 
          capturing non-option args</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="get_short_description"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_short_description</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_short_description">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Getter method for the short description of the command. Usually just a
  brief sentence about what the command will do, and what it expects.</p>
  <dl class="fields">
    <dt>Returns: <code>str</code></dt>
        <dd>A short description of the command and what it does</dd>
  </dl>
<div class="fields">      <p><strong>Note:</strong>
        Called by <a href="console.interactive.InteractiveShell-class.html"
        class="link">InteractiveShell</a> <code>help</code> command, which 
        lists all available commands and their descriptions.
      </p>
</div></td></tr></table>
</div>
<a name="get_help_message"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_help_message</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="console.interactive-pysrc.html#InteractiveCommand.get_help_message">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Getter method for the usage and instruction of using a command. This 
  is a longer docstring that describes the command, the operation of the 
  command, usage instructions, and all available options and arguments the 
  command will take.</p>
  <dl class="fields">
    <dt>Returns: <code>docstr</code></dt>
        <dd>The long description of the command including usage and 
          arguments.</dd>
  </dl>
<div class="fields">      <p><strong>Note:</strong>
        Called by <a href="console.interactive.InteractiveShell-class.html"
        class="link">InteractiveShell</a> <code>help command</code> -- 
        returns the specific usage instructions for <code>command</code>
      </p>
</div></td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="console-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/console/">console</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Tue Nov 30 11:33:30 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
